﻿<div ng-controller="InformationListC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">报价资讯</h1>
    </div>
    <div class="bg-light lter b-b wrapper-md">
        <div class="input-group">
            <span class="input-group-addon">供应商</span>
            <select class="form-control" ng-model="Providerid">
                <option value="">请选择供应商</option>
                <option ng-repeat="item in Providers" value={{item.Id}}>{{item.Name}}</option>
            </select>
            <span class="input-group-addon">类型</span>
            <select class="form-control" ng-model="typename">
                <option value="">请选择类型</option>
                <option value="螺纹钢">螺纹钢</option>
                <option value="盘螺">盘螺</option>
                <option value="线材">线材</option>
                <option value="钢坯">钢坯</option>
            </select>
            <span class="input-group-btn">
                <button class="btn btn-default" type="button" ng-click="getData()">查找</button>
            </span>
        </div>
    </div>
    <div class="container-fluid">
        <table class="table table-striped table-bordered">
            <thead>
            <tr>
                <th style="text-align: center;">时间/商品</th>
                <th style="text-align: center;">件数</th>
                <th style="text-align: center;">库存</th>
                <th style="text-align: left;">单价</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in lockOrders">
                <td class="text-center" style="">{{item.UpdateTime}}/{{item.Commodity.Brand}}/{{item.Commodity.Name}}/{{item.Commodity.Standard}}/{{item.Commodity.Format}}</td>
                <td class="text-center" style="width: 70px">{{item.Count | number:2}}</td>
                <td class="text-center" style="width: 70px">{{item.Amount | number:3}}</td>
                <td class="text-left" style="width: 70px">￥{{item.Price | number:2}}</td>
            </tr>
            </tbody>
        </table>
    </div>
</div>

<script>
    angular.module('app') //锁价单列表控制器
            .controller("InformationListC", function ($scope, $state, $http) {
                $scope.depotid = "";
                $scope.typename = "";
                //                获取仓库列表
                $http.get('../api/Provider?page=1&rows=9999')
                        .success(function (res) {
                            $scope.Providers = res.Data;
                        });
                $scope.page = 1;
                $scope.rows = 50;
                $scope.getData = function () {
                    $http({
                        url: "../api/Provider/DepotCommodity?depotId=" + $scope.Providerid + "&name=" + $scope.typename + "&page=" + $scope.page + "&rows=" + $scope.rows,
                        method: "GET"
                    })
                            .then(function (res) {
                                console.log(res.data);
                                $scope.lockOrders = res.data;
                            })
                            .then(function (error) {
                                if (error) {
                                    alert("数据获取失败");
                                }
                            });
                };
                //加载数据
                $scope.getData();
                $scope.zhuanhuan = function(item){
                    return new Date(item.UpdateTime.replace(/-/g, '/'));
                }

            });
</script>